<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>报名信息管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function downLoad(){
			
			// alert(document.cookie);
			
			if(confirm('温馨提示：导出结果基于查询条件，导出后，对应数据将被删除，务必保存好下载的文件（最多下载5000行）。是否确认导出？')){
				
				$("#tip").show();
				
				var timeStamp = new Date().getTime();
				var params = "";
				var register = $("#register").val();
				var mobile = $("#mobile").val();
				var joiner = $("#joiner").val();
				var school = $("#school").val();
				var remarks = $("#remarks").val();
				var status = $("#status").val();
				
				params += "register=" + register;
				params += "&mobile=" + mobile;
				params += "&joiner=" + joiner;
				params += "&school=" + school;
				params += "&remarks=" + remarks;
				params += "&order.status=" + status;
				// 时间戳
				params += "&timeStamp=" + timeStamp;
	    		// $("#downloadIframe").src = "${ctx}/ems/join/downLoad";
	    		$("#downloadIframe").attr("src","${ctx}/ems/join/downLoad?" + params)
	    		
	    		var interVal = setInterval(function(){
	    			var downToken = parent.getCookie('downToken');
	    			if(downToken == timeStamp)
    				{
    					clearInterval(interVal);
    					$("#tip").hide();
    				}
	    		},200);
    		}
	    }
		
		function initFrame()
		{
			//alert(document.getElementById("downloadIframe").readyState);
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/ems/join/">报名信息列表</a></li>
		<%-- <shiro:hasPermission name="ems:join:edit"><li><a href="${ctx}/ems/join/form">报名信息添加</a></li></shiro:hasPermission> --%>
	</ul>
	<form:form id="searchForm" modelAttribute="join" action="${ctx}/ems/join/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>家长姓名：</label>
				<form:input id="register" path="register" htmlEscape="false" maxlength="32" cssStyle="width:100px;" class="input-medium"/>
			</li>
			<li><label>家长电话：</label>
				<form:input id="mobile" path="mobile" htmlEscape="false" maxlength="32" cssStyle="width:100px;" class="input-medium"/>
			</li>
			<li><label>选手姓名：</label>
				<form:input id="joiner" path="joiner" htmlEscape="false" maxlength="32" cssStyle="width:100px;" class="input-medium"/>
			</li>
			<li><label>推选学校：</label>
				<form:input id="school" path="school" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label style="width: 100px;">备注(初选地点)：</label>
				<form:input id="remarks" path="remarks" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li><label>订单状态：</label>
				<form:select id="status" path="order.status">
					<form:option value="">请选择</form:option>
					<form:option value="1">已支付</form:option>
					<form:option value="0">待支付</form:option>
					<form:option value="-1">已失效</form:option>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="button" onclick="downLoad();" value="导出excel"/></li>
			
			<li id="tip" style="display: none;">
				<img style="width: 35px;height: 35px;" src="${ctxStatic }/images/loading.gif">正在导出...
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>订单编号</th>
				<th>家长姓名</th>
				<th>家长电话</th>
				<th>选手姓名</th>
				
				<th>性别</th>
				<th>出生年月</th>
				<th>年龄</th>
				
				<th>展示类别</th>
				<th>组别</th>
				
				<th>籍贯</th>
				<th>民族</th>
				<th>身份证号码</th>
				
				<th>展示方式</th>
				<th>展示大类</th>
				<th>展示小类</th>
				
				<th>专业等级</th>
				
				<th>推选学校</th>
				<th>报名状态</th>
				<th>报名时间</th>
				<th>支付总金额（元）</th>
				<th>备注(初选地点)</th>
				
				<shiro:hasPermission name="ems:join:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="join">
			<tr>
				<td><a href="${ctx}/ems/join/form?id=${join.id}">
					${join.order.orderNo}
				</a></td>
				<td>
					${join.register}
				</td>
				<td>
					${join.mobile}
				</td>
				<td>
					${join.joiner}
				</td>
				
				<td>
					${join.sex}
				</td>
				<td>
					${join.birth}
				</td>
				<td>
					${join.age}
				</td>
				
				<td>
					${join.course.name}
				</td>
				<td>
					${fns:getDictLabel(join.groupType, 'course_group_type', '')}
				</td>
				
				<td>
					${join.addr}
				</td>
				<td>
					${join.nation}
				</td>
				<td>
					${join.idCard}
				</td>
				
				<td>
					${fns:getDictLabel(join.joinType, 'course_join_type', '')}
				</td>
				<td>
					${join.bigCategoryName}
				</td>
				<td>
					${join.smallCategoryName}
				</td>
				
				<td>
					${join.level}
				</td>
				
				<td>
					${join.school}
				</td>
				<td>
					${join.order.status eq '-1'?'订单失效':join.order.status eq '0'?'待支付':join.order.status eq '1'?'已支付':'支付失败'}
				</td>
				<td>
					<fmt:formatDate value="${join.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${join.order.money}
				</td>
				<td>
					${join.remarks}
				</td>
				<shiro:hasPermission name="ems:join:edit"><td>
    				<a href="${ctx}/ems/join/form?id=${join.id}">修改</a>
					<a href="${ctx}/ems/join/delete?id=${join.id}" onclick="return confirmx('确认要删除该报名信息吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<iframe onload="initFrame();" onchange="initFrame();" id="downloadIframe" onreadystatechange="initFrame();" src="" style="display:none;" />
</body>

</html>